<template>
  <div class="toast">
    <div class="toast-box">
      <img class="toast-done" src="./images/done.png" />
      <div class="toast-content">
        <div  v-html="message" class="content-size"></div>
        <a class="toast-btn" v-if="btnText" @click="handleClick">{{ btnText }}</a>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      message: '',
      btnText: '',
      btnOnClick: null,
    };
  },

  methods: {
    handleClick() {
      if (!this.btnOnClick) return;

      this.btnOnClick();
    },
  },
};
</script>

<style lang="scss" scoped>
.toast {
  position: fixed;
  left: 0;
  top: 5.33rem;
  width: 100vw;
  height: 100vh;
  z-index: 10;
  display: flex;
  justify-content: center;
  animation: fade-up 0.1s linear both;

  &-box {
    display: flex;
    align-items: center;
    width: 4.02rem;
    height: 4.43rem;
    display: flex;
    flex-direction: column;
    background: #4C4C4C;
    border-radius: 0.32rem;
  }

  &-done {
    position: relative;
    width: 1.07rem;
    height: 1.07rem;
    margin-top: 0.75rem;
    margin-bottom: 0.43rem;
  }

  &-content {
    padding-left:0.75rem;
    padding-right: 0.75rem;
    width: 3.17rem;
    height: 0.64rem;
    font-family: PingFangSC-Regular, PingFang SC;
    // font-weight: 400;
    font-size: 0.453rem;
    color: rgba(255, 255, 255, 0.9);
    line-height: 0.64rem;
    text-align: center;
  }

  &-btn {
    color: #417ff9;
    display: inline-block;
  }
}

@keyframes fade-up {
  0% {
    opacity: 0;
    transform: translateY(12px);
  }

  100% {
    opacity: 1;
    transform: translateY(0);
  }
}
</style>
<style lang="scss">
@media screen and (max-width:280px){
    body{
      font-size:12px
    }
}
@media screen and (min-width:321px) and (max-width:480px){
    body{
      font-size:16px
    }
}

@media screen and (min-width:481px) and (max-width:539px) {
  body{
      font-size:18px //设备大于手机设备小于最大设计稿尺寸
    }
}
@media screen and (min-width:540px) {
  body{
    font-size:22px //设备大于最大设计稿尺寸
  }
}
@media screen  and (min-device-width:540px) and (max-device-width:767px){
  body{
    font-size:22px //surface-duo 设备
  }
}
@media only screen and (min-device-width: 768px) and (max-device-width: 1024px) and (orientation : portrait){
  body{
    font-size:24px // 平板设备
  }
  .content-size{font-size:24px} // 平板设备
}
</style>
